package com.arpa.wms.domain.enums;

import com.baomidou.mybatisplus.core.enums.IEnum;

import java.util.HashMap;
import java.util.Map;

/**
 * 表单编码前缀，用于生成表单号时，区分wms、oms相同前缀表单，让其分开计数
 * @author xuyang
 * @date 2020-11-09 16:40:03
 **/
public enum OrderIdPrefixEnum implements IEnum<String> {
    /**
     * 表单编码前缀
     */
    WMS("WMS:", "wms表单编码前缀"),
    OMS("OMS:", "oms表单编码前缀"),;

    /**
     * 值
     */
    private final String value;

    /**
     * 描述
     */
    private final String desc;

    OrderIdPrefixEnum(final String value, final String desc) {
        this.value = value;
        this.desc = desc;
    }
    private static final Map<String, OrderIdPrefixEnum> map = new HashMap();

    static {
        OrderIdPrefixEnum[] values = values();
        int length = values.length;
        for(int i = 0; i < length; i++){
            OrderIdPrefixEnum value1 = values[i];
            map.put(value1.getValue(),value1);
        }
    }

    public static OrderIdPrefixEnum getEnumByValue(String value){

        return map.get(value);
    }
    @Override
    public String getValue() {
        return this.value;
    }

    @Override
    public String toString(){
        return this.desc;
    }

    public String getDesc() {
        return this.desc;
    }
}
